/*
 * PlacePropertyPredicate.java
 * 
 * Created on Jun 4, 2007, 11:47:43 PM
 * 
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.infomancers.workflow.dynamic;

import com.infomancers.collections.Predicate;
import com.infomancers.workflow.Place;

/**
 *
 * @author aviadbd
 */
public class PlacePropertyPredicate implements Predicate<Place> {

    private String propertyName;
    private String value;
    
    public PlacePropertyPredicate(String propertyName, String value) {
        this.propertyName = propertyName;
        this.value = value;
    }

    public boolean isTrue(Place item) {
        String result = item.getProperties().get(propertyName);

        return value == null ? result == null : value.equals(result);
    }
}
